package Nio;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.01.20.12.41
 */
public class Nio1 {
    public static void main(String[] args) {
        Path p= Paths.get("a1.txt");
        p.getFileName();
        System.out.println(p);
        System.out.println(p.toFile());
        System.out.println(p.toUri());
        if(Files.exists(p)){
            System.out.println("文件存在");
        }else {
            try {
                Files.createFile(p);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }


}
